package com.ag.admin.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.bean.TbDeptType;
import com.ag.bean.TbUserDept;
import com.ag.common.BaseAction;
import com.ag.contactTree.service.LocalTreeService;

@Scope("prototype")
@Controller("userDeptAction")
public class UserDeptAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	private static final Logger logger = Logger.getLogger(UserDeptAction.class);
	
	@Resource(name="LocalTreeService")
	private LocalTreeService localTreeService;
	private List<TbDeptType> deptTypes;
	private List<TbUserDept> userDepts;
	private String dtId;
	private String udId;
	
	public void checkReponsibleDept(){
		logger.info("udId="+udId);
		Boolean b = this.localTreeService.checkChargePeopleExist(udId);
		this.outJsonString(b.toString());
	}
	
	public String findAllDeptType(){
		deptTypes = this.localTreeService.findDeptType();
		logger.info(deptTypes.size());
		return "findAllDeptType";
	}
	
	public String findUserDeptByDtId(){
		userDepts = this.localTreeService.findBydeptType(dtId);
		logger.info(userDepts.size());
		return "findUserDeptByDtId";
	}

	public List<TbDeptType> getDeptTypes() {
		return deptTypes;
	}

	public void setDeptTypes(List<TbDeptType> deptTypes) {
		this.deptTypes = deptTypes;
	}



	public String getDtId() {
		return dtId;
	}

	public void setDtId(String dtId) {
		this.dtId = dtId;
	}

	public String getUdId() {
		return udId;
	}

	public void setUdId(String udId) {
		this.udId = udId;
	}

	public List<TbUserDept> getUserDepts() {
		return userDepts;
	}

	public void setUserDepts(List<TbUserDept> userDepts) {
		this.userDepts = userDepts;
	}

}
